/<template>
  <div class="content">
    <div>每行一个别名，多个按回车后添加</div>
    <div>
      <el-input
        v-model="textarea"
        type="textarea"
        :autosize="{ minRows: 5, maxRows: 14}"
        placeholder="请输入内容"
      >
      </el-input>
    </div>
    <div class="dialog-footer rowFlex">
      <div class="btns">
        <el-button
          class="btn"
          @click="close"
        >取 消</el-button>
        <el-button
          :loading="loading"
          class="btn"
          type="primary"
          @click="onSubmit"
        > 确定</el-button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    rowInfo: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      loading: false,
      textarea: ''
    }
  },
  mounted() {
    this.rowInfo.forEach((item, index) => {
      this.textarea += item + '\n'
    })
  },
  methods: {
    close() {
      this.$emit('cancel')
    },
    onSubmit() {
      let aliasList = this.textarea.split('\n')
      aliasList = aliasList.filter((item) => {
        return item
      })
      console.log(aliasList, '>>>>>>>>>>>>aliasList')
      this.$emit('ok', aliasList)
    }
  }
}
</script>

<style lang="scss" scoped>
.content {
  padding: 20px;
}
</style>